<extend name='./Public/Base/base.html' />
<block name='script'>
	<link rel="stylesheet" href="__PUBLIC__/Admin/service_list.css"> 
</block>
<block name='content'>

<div class='container-layout'>
	<div class='line margin'>
		<div class='x9'>首页 / 功能管理 / 用户管理</div>
		<div class='x3'>
			<span class='border button button-little bg-blue Admin_Auth_User_Add'>
				<span class='icon-plus-square-o'></span>
				添加新用户
			</span>
		</div>
	</div>

	<!--添加服务-->
	<div class='line hidden Admin_Auth_User_Add_Inputs'>
		<div class='x2 '>
			<lable class='label'>用户名：
				<input type='text' class='input' name='User_Name' />
			</lable>
		</div>
		<div class='x2 '>
			<lable class='label'>密码：
				<input type='password' class='input' name='User_Pwd' />
			</lable>
		</div>
		<div class='x2 Padding-top20'>
			<button type='button' class='button bg-sub Admin_Auth_User_Add_But' >添加</button>
		</div>
	</div>




	

	<!--显示数据-->
	<div class='line'>
		<div class='x12'>
			<table class='table Service_list'>
				<tr>
					<th>用户名</th>
					<th>所属组</th>
					<th>权限列表</th>
					<th>创建时间</th>
					<th>操作</th>
				</tr>
				<volist name='data_ThinkUser.list' id='vo'>
					<if condition="$vo.name neq 'admin'" >
						<tr>
							<td>{$vo.name}</td>
							<td>{$vo.group_name}</td>
							<td>{$vo.nav2}</td>
							<td>{$vo.ctime|date='Y-m-d',###}</td>
							<td>
								<a href='admin_auth_user_edit?uid={$vo.id}&uname={$vo.name}&gid={$vo.group_id}' class='button button-little bg-sub UserEdit' >编辑</a>
								<a class='button button-little bg-sub UserDel' uid='{$vo.id}'>删除</a>
							</td>
						</tr>
					</if>
				</volist>
			</table>			
		</div>
		<if condition="$data_Nav1_Count gt 0">
			<div class='x2'><a class='button button-little bg-red Nav1Dels'><span class='icon-trash-o'></span> 删除选中</a></div>
		</if>
	</div>

	<!--显示分页
	<div class='line margin-large'>
		<if condition="$data_Nav1_Count gt 0">
			<div class='x12  text-center'>
				{$data_Nav1['fpage']}
			</div>
		</if>
	</div>-->

</div>





</block>
<block name='bottom'>
	<script src="__PUBLIC__/Admin/admin_nav1.js"></script> 
	<script>
		$(function(){
			$('.UserDel').click(function(){
				if(!confirm('确认删除？')){
					exit;
				}
				var uid = $(this).attr('uid');
				$.ajax({
					url:'admin_auth_user_del',
					data:{
						uid:uid,
					},
					type:'post',
					success:function(res){
						switch(res){
							case "e1":
								alert('uid 丢失！');
								break;
							case "e2":
								alert('删除失败！');
								break;
							case "ok":
								alert('删除成功！');
								location.reload(true);
								break;
						}
					}
				});
			});

			$('.Admin_Auth_User_Add').click(function(){
				$('.Admin_Auth_User_Add_Inputs').removeClass('hidden');
			});



			$('.Admin_Auth_User_Add_But').click(function(){
				var User_Name = $('input[name=User_Name]').val().trim();
				var User_Pwd = $('input[name=User_Pwd]').val().trim();
				if(!User_Name || !User_Pwd){
					//alert('数据不得为空！');exit;
				}
				$.ajax({
					url:'admin_auth_user_add',
					data:{
						User_Name:User_Name,
						User_Pwd:User_Pwd
					},
					type:'post',
					success:function(res){
						switch(res){
							case "e1":
								alert('数据不得为空!');
								break;
							case "e2":
								alert('用户名以存在!');
								break;
							case "e3":
								alert('添加用户失败!');
								break;
							case "ok":
								alert('添加用户成功！');
								location.reload(true);
								break;
						}
					}
				});

			});
		});
	</script>
</block>